package com.yolo.yolorpc.serializer;


import cn.hutool.core.io.resource.BytesResource;

import java.io.IOException;

/**
 * @Program: RPC
 * @description: 序列化器接口
 * @author: yolo
 * @create: 2025-04-21 16:19
 **/
public interface Serializer {


    /**
     * @descript:
     * @author: yolo
     * @date: 2025/4/21 16:23
     * @param object 要序列化的串
     * @return: Byte 字节串
     **/
    <T> byte[] serialize(T object) throws Exception;


    /**
     * @descript:
     * @author: yolo
     * @date: 2025/4/21 16:25
     * @param bytes
     * @param type
     * @return: T
     **/
    <T> T deserialize(byte[] bytes, Class<T> type) throws IOException;
}
